package com.example.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.annotation.AutoTable;
import com.example.annotation.TableColumn;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品实体类
 */
@Data
@TableName("tb_product")
@AutoTable(value = "tb_product", comment = "商品表")
public class Product {
    
    @TableId(type = IdType.AUTO)
    @TableColumn(value = "id", type = "BIGINT", primaryKey = true, autoIncrement = true, nullable = false, comment = "主键ID")
    private Long id;
    
    @TableColumn(value = "product_name", type = "VARCHAR", length = 200, nullable = false, comment = "商品名称")
    private String productName;
    
    @TableColumn(value = "product_code", type = "VARCHAR", length = 50, nullable = false, unique = true, comment = "商品编码")
    private String productCode;
    
    @TableColumn(value = "category", type = "VARCHAR", length = 50, index = true, comment = "商品分类")
    private String category;
    
    @TableColumn(value = "price", type = "DECIMAL(10,2)", nullable = false, comment = "商品价格")
    private BigDecimal price;
    
    @TableColumn(value = "stock", type = "INT", defaultValue = "0", comment = "库存数量")
    private Integer stock;
    
    @TableColumn(value = "description", type = "TEXT", comment = "商品描述")
    private String description;
    
    @TableColumn(value = "status", type = "TINYINT", defaultValue = "1", comment = "状态：0-下架，1-上架")
    private Integer status;
    
    @TableLogic
    @TableColumn(value = "deleted", type = "TINYINT", defaultValue = "0", comment = "逻辑删除：0-未删除，1-已删除")
    private Integer deleted;
    
    @TableColumn(value = "create_time", type = "DATETIME", nullable = false, comment = "创建时间")
    private LocalDateTime createTime;
    
    @TableColumn(value = "update_time", type = "DATETIME", comment = "更新时间")
    private LocalDateTime updateTime;
}
